app.controller('BusShiftStaionModalCtrl', function ($scope, $modalInstance, param, ajax) {

	$scope.ids = [];
	$scope.list = [];
	$scope.param = param;
	if ($scope.param.data == null) $scope.param.data = {};

	//获取站点列表
	$scope.loadStationList = function () {
		ajax.call(new Req.GET({
			resource: 'shift/bs/station/' + $scope.param.data.id + '/list'
		})).then(function (result) {
			$scope.list = result.result;
		}, function () { });
	};
	$scope.loadStationList();

	$scope.update = function (station) {
		station.disabled = !station.disabled;
	};

	$scope.ok = function () {
		if ($scope.myForm.$valid) {
			for (var i = 0; i < $scope.list.length; i++) {
				$scope.ids.push({ id: $scope.list[i].id, disabled: $scope.list[i].disabled });
			}
			$modalInstance.close($scope.ids);
		}
	};

	$scope.cancel = function () {
		$modalInstance.dismiss('cancel');
	};
});